package net.liteheaven.xblib.common.res;

import android.content.Context;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;

public class RawUtil {
	
	public static String loadRawString(Context ctx, int rawId) {
		InputStream is = ctx.getResources().openRawResource(rawId);
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		byte[] buf = new byte[1024];
		int len;
		try {
			while ((len = is.read(buf)) != -1) {
				baos.write(buf, 0, len);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return baos.toString();
	}

}
